home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Home CD Sampler / Microsoft Home CD Sampler.iso / multi / dinodemo / dinodemo.dxr / 00506_AllMacros.txt < prev    next >
Encoding:
Text File  |  1995-10-09  |  8.8 KB  |  319 lines

  1. -- Shared Cast macros for entire CD
  2.  
  3. --hilite macro
  4. macro pressOn
  5.     puppetSound 0
  6.     set whichSprite = the clickOn
  7.   puppetSPRITE whichSprite,true
  8.     global lastClickOn
  9.     set lastClickOn = whichSprite
  10.   set the locV of sprite whichSprite to (the locV of sprite whichSprite) + 4
  11.   PUPPETSOUND "clickSound"
  12.   updateStage
  13.   repeat while the stillDown
  14.     if rollOver(whichSprite) then
  15.     else
  16.       set the locV of sprite whichSprite to (the locV of sprite whichSprite) - 4
  17.       --set the locV of sprite 4 to 500
  18.       PUPPETSOUND "clickSound"
  19.       updateStage
  20.       puppetSPRITE whichSprite,false
  21.       updateStage  --force button rebound before playOrGo call
  22.       exit
  23.     end if
  24.   end repeat
  25.   set the locV of sprite whichSprite to (the locV of sprite whichSprite) - 4
  26.   --set the locV of sprite 4 to 500
  27.   PUPPETSOUND "clickSound"
  28.   puppetSPRITE whichSprite,false
  29.   updateStage
  30.   updateStage  --force button rebound before playOrGo call with extra update
  31.   --score script takes over here
  32. end pressOn
  33.  
  34.  
  35. macro PaintOn
  36.     puppetSound 0
  37.     set whichSprite = the clickOn
  38.     global hiliteSprite,lastClickOn
  39.     set lastClickOn = whichSprite
  40.   set the locV of sprite whichSprite to (the locV of sprite whichSprite) + 4
  41.   set the locV of sprite hiliteSprite to (the locV of sprite whichSprite +6)
  42.   set the locH of sprite hiliteSprite to the locH of sprite whichSprite
  43.   PUPPETSOUND "clickSound"
  44.   updateStage
  45.   repeat while the stillDown
  46.     if rollover(whichSprite)=false then
  47.       set the locV of sprite whichSprite to (the locV of sprite whichSprite) - 4
  48.       set the locV of sprite hiliteSprite to 700
  49.       PUPPETSOUND "clickSound"
  50.       updateStage
  51.       updateStage  --force button rebound before playOrGo call
  52.       exit
  53.     end if
  54.   end repeat
  55.   set the locV of sprite whichSprite to (the locV of sprite whichSprite) - 4
  56.   set the locV of sprite hiliteSprite to 700
  57.   PUPPETSOUND "clickSound"
  58.   updateStage
  59.   updateStage  --force button rebound before playOrGo call
  60.     --score script takes over here
  61.   end if
  62.  
  63. --groupSelect macro
  64. macro GroupSelect whichSprite
  65.     global lastClickOn
  66.     set lastClickOn = clickOn()
  67.   if rollOver(whichSprite) then
  68.     set the locV of sprite (whichSprite + 1) to the locV of sprite whichSprite
  69.     PUPPETSOUND "clickSound"
  70.     updateStage    
  71.     repeat while the stillDown
  72.       if rollOver(whichSprite + 1) then
  73.       else
  74.         set the locV of sprite (whichSprite + 1) to 600
  75.         PUPPETSOUND "clickSound"
  76.         updateStage
  77.         exit
  78.       end if
  79.     end repeat
  80.   end if
  81.  
  82.  
  83. --mainMenu macro
  84. macro MainCat whichSprite, theMoovSelect
  85.   PUPPETSOUND "clickSound"
  86.   repeat while the stillDown
  87.     if rollOver(whichSprite) then
  88.       go frame the frame
  89.     else
  90.       go frame theMoovSelect
  91.     end if
  92.   end repeat    
  93.  
  94. -- time delay utility
  95. macro waitFor seconds
  96.   set now = the timer
  97.   repeat while the timer < (now + (seconds * 60))
  98.   if the mousedown then exit
  99.  end repeat
  100.  
  101.  
  102. --used by Baseball to hold playback head for wav file to finish
  103. macro runhalt  
  104.   mci "status Phil mode"
  105.   if the result = "playing" then
  106.     go frame the frame  --keep checking until ok
  107.   else
  108.     go frame the frame + 1
  109.     preLoad marker (1)  --preload cast for next segment before 
  110.   end if                         --playing wav to avoid disk interrupts
  111.  
  112.  
  113. --
  114. macro waitFordep seconds
  115.   set now = the timer
  116.   repeat while the timer < (now + (seconds * 60))
  117.     nothing
  118.   end repeat
  119. --
  120. macro tmwaitFor seconds
  121.   set now = the timer
  122.   repeat while the timer < (now + (seconds * 60))
  123.   if the mousedown then exit 
  124.   end repeat
  125.  
  126.  
  127. -- sound delay
  128. macro tmwaitSound thisone
  129.    repeat while soundbusy(1)
  130.    updatestage
  131.   if the mousedown then exit
  132.    end repeat
  133.  
  134.  
  135. -- sound delay
  136. --macro waitSound thisone
  137. --  repeat while soundbusy(1)
  138. --     updatestage
  139. --     if the mousedown then exit
  140. --   end repeat
  141.  
  142. --
  143. macro waitSound thisone
  144.   updatestage
  145.   if soundbusy(1) = FALSE then go to the frame +1
  146.   else go to the frame
  147.  
  148. -- utility
  149. macro upperCase s
  150.   set r = EMPTY
  151.   set len = length( s )
  152.   repeat with i = 1 to len
  153.     set c = chars( s, i, i )
  154.     if charToNum( c ) >= 97 AND charToNum( c ) <= 122 then ├é
  155.       set c = numToChar( charToNum( c ) - 32 )
  156.     set r = r & c
  157.   end repeat
  158.   return r
  159.  
  160.  
  161.  
  162. --macro for overview buttons in sub menus
  163. macro playAll playListLine
  164. global fromMoov,fromType,playAllList,playAllCounter,fromFrame
  165. global lastClickOn
  166. if fromType = "playLoop" then
  167.       nothing
  168.   else
  169.       if lastClickOn <> clickOn() then exit
  170. end if
  171.   set fromFrame=the frame
  172.   set fromType = "playAll"
  173.   set playAllList = line playListLine of field "playList"
  174.   set playAllCounter = 1
  175.   set movieName = item 1 of playAllList
  176.   if machineType() =256 then set movieName=movieName&".mmm"
  177.   go movie movieName  -- get ball rolling, and goPlayAll handles list of movies to show
  178. exit    
  179.  
  180. --macro to control goBack for playAll movies
  181. macro goPlayAll
  182. global fromType,playAllList,playAllCounter,fromFrame,mainPath,loopCounter
  183. set movieName="main"
  184.     if fromType = "playAll" then
  185.           if (playAllCounter + 1) > the  number of items in playAllList then  --are we done with all items?
  186.                 go frame fromFrame of movie mainPath&movieName   --if so, go back to main menu
  187.             else
  188.               set movieName =item (playAllCounter + 1) of playAllList  --if still items left, then go next movie in list
  189.               if the machineType = 256 then set movieName=movieName&".mmm"
  190.               set playAllCounter=playAllCounter + 1
  191.               go movie movieName
  192.           end if
  193.       --else if fromType = "playLoop" then
  194.       --if line (loopCounter + 10) of field "playList" = "EOF" then set loopCounter = 1  --check for end of list & reset
  195.       --set movieName = line (loopCounter + 10) of field "playList"  -- load next movie from list
  196.       --if the machineType = 256 then set movieName=movieName&".mmm"
  197.       --set loopCounter=loopCounter + 1
  198.       --go movie movieName
  199.     else
  200.       nothing
  201.     end if   
  202.  
  203.  
  204. --alternate macro for the following complicated pile...does not address multiple directories
  205. macro playOrGo movieName,frameName,moovMode
  206.  
  207. global fromMoov, fromFrame,fromType,mainPath,lastClickOn
  208. if lastClickOn <> clickOn() then exit
  209. set demoPath=pathname()&movieName&":"
  210. if the machineType = 256 then set movieName=movieName&".mmm"
  211. set fromType = moovMode
  212. if moovMode = "play" then
  213.     if frameName = "" then
  214.         if movieName = "" then
  215.             nothing
  216.         else
  217.             play movie movieName
  218.             exit
  219.         end if
  220.     else
  221.     play frame frameName of movie movieName
  222.     end if 
  223. --else if moovMode = "playloop" then  --called from movie timeoutscript  "backtoLoop"
  224.     --set fromFrame = the frame
  225.     --go movie movieName
  226.     --exit
  227. else if moovMode = "full" then
  228.     set fromFrame = the frame
  229.         if movieName = "" then
  230.             nothing
  231.         else
  232.             go movie demoPath&movieName
  233.             exit
  234.         end if
  235. else if moovMode = "exit" then
  236.         if movieName = "" then
  237.             nothing
  238.         else
  239.             go movie mainPath&movieName
  240.             exit
  241.         end if
  242. else
  243.     if frameName = "" then
  244.         if movieName = "" then
  245.             nothing
  246.         else
  247.             go movie movieName
  248.             exit
  249.         end if
  250.     else
  251.     go frame frameName of movie movieName
  252.     end if 
  253. end if
  254.  
  255. --macro for easy return from playOrGo
  256. macro goBack
  257. global fromType,fromFrame,mainPath
  258. set movieName="main"
  259. if the machineType = 256 then set movieName=movieName&".mmm"
  260. waitFor 2
  261. if fromType = "play" then
  262.     play done
  263.     set the timeoutscript to "backToLoop"
  264.     exit
  265. else if fromType = "playAll" then
  266.     if clickOn()>22 then
  267.             go frame fromFrame of movie mainPath&movieName  --standard "go" bail to main menu
  268.             set the timeoutscript to "backToLoop"
  269.             exit
  270.         else
  271.             go frame the frame + 2  --skip over any one moment please frames
  272.             exit
  273.     end if
  274.     exit
  275. else
  276.     go frame fromFrame of movie mainPath&movieName  --standard "go" bail to main menu
  277.     set the timeoutscript to "backToLoop"
  278.     exit
  279. end if
  280.  
  281. --
  282. macro notYet feature
  283.   alert feature && "not implemented yet."
  284.  
  285. --
  286. macro dospath drive, path
  287.   set newpath = ""
  288.   set count = 1
  289.   set newpath = newpath&drive&":"
  290.   repeat while count <= the number of chars in path
  291.  
  292.     if char count of path = ":" then
  293.       set newpath = newpath & "\"
  294.     else
  295.       set newpath = newpath & char count of path
  296.     end if
  297.     set count = count +1
  298.   end repeat
  299.   return newpath
  300. end dospath
  301.  
  302. --macro for determining whether we are in a pauseMode or not via "Alt-Shift"
  303. macro evalPauseState
  304.     global theCurPalette,myTMdll
  305.         if machineType()=256 then
  306.             if line 1 of myTMdll(mGetTaskList)<>"MSHOME" then
  307.                 puppetSound 0
  308.                 repeat while  line 1 of mYTMdll(mGetTaskList)<>"MSHOME"
  309.                     go frame the frame
  310.                 end repeat
  311.                 puppetPalette theCurPalette
  312.                 puppetPalette 0
  313.         else   
  314.             puppetSound 0
  315.             beep
  316.         end if
  317.     end if
  318.  
  319.